package domain

import (
	"BookStack/internal/domain/article"
	"BookStack/internal/domain/book"
	"BookStack/internal/domain/category"
	"BookStack/internal/domain/navigation"
	"BookStack/internal/domain/page"
	"BookStack/internal/domain/tag"
	"BookStack/internal/domain/user"
)

// Service 服务工厂
type Service struct {
	User       user.Service
	Article    article.Service
	Book       book.DomainService
	Page       page.Service
	Category   category.Service
	Tag        tag.Service
	Navigation navigation.Service
	// TODO: 添加其他模块
}

// NewService 创建服务工厂
func NewService(
	userRepo user.Repository,
	articleRepo article.Repository,
	// 书籍模块
	bookRepo book.BookRepository,
	chapterRepo book.ChapterRepository,
	recycleBinRepo book.RecycleBinRepository,
	// 自定义页面模块
	pageRepo page.Repository,
	// 分类模块
	categoryRepo category.Repository,
	// 标签模块
	tagRepo tag.Repository,
	// 导航模块
	navigationRepo navigation.Repository,
	// TODO: 添加其他模块
) *Service {
	return &Service{
		User:       user.NewUserService(userRepo),
		Article:    article.NewArticleService(articleRepo),
		Book:       book.NewDomainService(bookRepo, chapterRepo, recycleBinRepo),
		Page:       page.NewPageService(pageRepo),
		Category:   category.NewService(categoryRepo),
		Tag:        tag.NewService(tagRepo),
		Navigation: navigation.NewService(navigationRepo),
	}
}
